function txtCopy(txtId, trigerBtnId, srcBtnName) {
    var v = document.getElementById(txtId);
    if (v.value == '') {
        return;
    }
    v.select(); // 选择对象
    if (document.execCommand("Copy")) { // 执行浏览器复制命令
        document.getElementById(trigerBtnId).innerHTML = '已复制成功';
        setTimeout(function() {
            document.getElementById(trigerBtnId).innerHTML = srcBtnName;
        },
            1500);
    }

}

function txtClear(txtId) {
    document.getElementById(txtId).value = '';
}


function txtTransform(targetId, srcId, transformCall, changeAfterCall) {
    if (document.getElementById(srcId).value == '') {
        return;
    }

    document.getElementById(targetId).value = transformCall(document.getElementById(srcId).value);

    changeAfterCall();
}


function findSelected(selectDom) {
    var index = selectDom.selectedIndex;
    return selectDom.options[index];

}

function nowTimeStr(){
    return stampToStr(new Date().getTime(), 'yyyyMMddHHmmss', 1);
}

function stampToStr(timestamp, formatPattern, t) {
    var date = new Date(timestamp * t);
    var year = date.getFullYear();
    var month = 1 + date.getMonth();
    var dates = date.getDate();
    var hour = date.getHours();
    var min = date.getMinutes();
    var second = date.getSeconds();

    var str = formatPattern;
    return formatPattern.replace('yyyy', year)
        .replace('MM', (month < 10 ? '0' + month : '' + month))
        .replace('dd', (dates < 10 ? '0' + dates : '' + dates))
        .replace('HH', (hour < 10 ? '0' + hour : '' + hour))
        .replace('mm', (min < 10 ? '0' + min : '' + min))
        .replace('ss', (second < 10 ? '0' + second : '' + second));

}